<template>
  <div class="account">
    <a-row :gutter="gutter">
      <a-col>
        <a-button type="primary" @click="backList">返回</a-button>
      </a-col>
    </a-row>
    <a-table
      :columns="columns"
      rowKey="id"
      :dataSource="columnsData"
      :pagination="pagination"
      :loading="loading"
    >
    </a-table>
    <pagination
      :total="total"
      @loadDataList="pageInit"
      ref="pageBand"
    />
  </div>
</template>

<script>
// 消息信息
import { partnerNotice } from '../../../store/providerApi'
export default {
  data() {
    return {
      total: 0,
      form: this.$form.createForm(this),
      gutter: {
        xs: 8,
        sm: 16,
        md: 16,
        lg: 24,
        xl: 24,
        xxl: 10
      },
      pagination: false,
      loading: false,
      columns: [
        {
          title: '序号',
          dataIndex: 'index'
        },
        {
          title: '消息标题',
          dataIndex: 'title'
        },
        {
          title: '消息短标题',
          dataIndex: 'short_title'
        },
        {
          title: '消息摘要',
          dataIndex: 'summary'
        },
        {
          title: '消息正文',
          dataIndex: 'content'
        },
        {
          title: '消息状态',
          dataIndex: 'status'
        },
        {
          title: '阅读状态',
          dataIndex: 'is_read'
        },
        {
          title: '创建时间',
          dataIndex: 'created_at'
        },
        {
          title: '阅读时间',
          dataIndex: 'read_at'
        }
      ],
      columnsData: []
    }
  },
  // mounted () {
  //   this.pageInit()
  // },
  methods: {
    pageInit(info) {
      partnerNotice({
        id: this.$route.query.id,
        page: info.page,
        num: info.pageSize
      }).then(res => {
        var array = res.data.list
        for (let i = 0; i < array.length; i++) {
          array[i]['index'] = (info.page - 1) * info.pageSize + (i + 1)
        }
        this.columnsData = array
        // 分页器总页数
        this.total = res.data.total_num
      })
    },
    backList() {
      this.$router.push('/menu/provider/list')
    }
  }
}
</script>

<style lang="scss" scoped>
.account {
  margin-top: 15px;
  .price-content {
    margin-top: 20px;
    font-size: 20px;
  }
}
</style>